# -*- coding: utf-8 -*-
# @ Time   :  2020/3/17 10:16
# @ Author : Redtree
# @ File :  reader
# @ Desc : 资源文件加密工具

import os

def alt_enc():
    path1 = 'resup'
    path2 = 'res'
    for root, dirs, files in os.walk(path1):
        for file in files:
          cpath = os.path.join(root,file)
          opath = cpath.replace(path1,path2)
          opath = opath.replace('.jpg','.alt')
          opath = opath.replace('.png','.alt')
          opath = opath.replace('.wav','.alt')
          opath = opath.replace('.mp3','.alt')
          f = open(cpath,'rb')
          data = f.read()
          print(data)
          f.close()
          o = open(opath,'wb')
          o.write(data)
          o.close()


alt_enc()
